<template>
  <div class="head">
    <el-row>
      <el-col :span="24">
        <div class="title1">
          <el-form
            ref="form"
            style="display: flex;flex-wrap: wrap;justify-content: space-between;"
            :model="form"
            label-width="80px"
          >
            <div style="display: flex;justify-content: space-between;flex-wrap: wrap;width: 1600px;">
              <el-form-item
                label-width="80px"
                class="text"
                label="运单编号"
              >
                <el-input
                  v-model="form.transportCode"
                  style="width: 286px;"
                  placeholder="请输入"
                />
              </el-form-item>
              <el-form-item
                class="text"
                label="查询维度"
              >
                <el-select
                  v-model="form.dimension"
                  :disabled="true"
                  class="input"
                  style="width: 92px;"
                  placeholder="网点"
                >
                  <el-option
                    label="网点"
                    value="1"
                  />
                </el-select>
                <el-select
                  v-model="form.networkName"
                  :disabled="true"
                  class="input"
                  style="width: 182px;margin-left: 12px;"
                  placeholder="辽宁盘锦公司"
                >
                  <el-option
                    label="辽宁盘锦公司"
                    value="1"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                class="text"
                label="费用类别"
              >
                <el-select
                  v-model="form.feeType"
                  class="input"
                  placeholder="请选择"
                >
                  <el-option
                    label="中转费"
                    value="1"
                  />
                  <el-option
                    label="短驳费"
                    value="2"
                  />
                  <el-option
                    label="中心打包费"
                    value="3"
                  />
                </el-select>
              </el-form-item>
              <el-form-item
                class="text"
                label="站点类型"
              >
                <el-select
                  v-model="form.stationType"
                  class="input"
                  placeholder="请选择"
                >
                  <el-option
                    label="收费站点"
                    value="1"
                  />
                  <el-option
                    label="付费站点"
                    value="2"
                  />
                </el-select>
              </el-form-item>
            </div>
            <div>
              <el-form-item>
                <el-button
                  type="primary"
                  @click="onSubmit"
                >查询</el-button>
                <el-button @click="khClear">重置</el-button>
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div
          class="title1"
          style="margin-left: 40px;"
        >
          <el-form
            ref="form"
            style="display: flex;justify-content: space-between;flex-wrap: wrap;"
            label-width="40px"
            :model="form"
          >
            <div style="display: flex;flex-wrap: wrap;">
              <el-form-item
                class="text"
                label="日期"
              >
                <el-date-picker
                  v-model="value1"
                  class="input1"
                  type="daterange"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期"
                  value-format="yyyy-MM-dd"
                  style="width: 698px;"
                  @change="changeTime"
                />
              </el-form-item>
            </div>
          </el-form>
        </div>
        <div class="line" />
        <div class="title3">
          <div class="text">2022-10-20此菜单将下线，后续请转到对账管理--总部网点对账查询（单号查询）</div>
          <div>
            <el-form>
              <el-form-item>
                <el-button
                  class="bt"
                  @click="onSubmit"
                ><i class="el-icon-upload2" />导出</el-button>
              </el-form-item>
            </el-form>
          </div>
        </div>
        <el-table
          v-loading="loading"
          :data="tableData"
          :header-cell-style="{ background: '#f6f6f6' }"
          style="width: 100%"
          max-height="734"
          border
        >
          <el-table-column
            type="index"
            :index="table_index"
            width="50"
            align="center"
          />
          <el-table-column
            prop="settleDate"
            label="结算日期"
            align="center"
          />
          <el-table-column
            prop="firstSettleDate"
            label="第一次结算日期"
            align="center"
            width="120"
          />
          <el-table-column
            prop="transportCode"
            label="运单号"
            align="center"
          />
          <el-table-column
            prop="bagCode"
            label="大包号"
            align="center"
          />
          <el-table-column
            prop="addresseeNetworkName.networkName"
            label="收件网点名称"
            width="110"
            align="center"
          />
          <el-table-column
            prop="payNetworkName.networkName"
            label="付费站点名称"
            width="110"
            align="center"
          />
          <el-table-column
            prop="paySuperiorsNetworkName.networkName"
            label="付费上级站点名称"
            width="140"
            align="center"
          />
          <el-table-column
            prop="payCity"
            label="付费城市名称"
            width="110"
            align="center"
          />
          <el-table-column
            prop="transferCentreId"
            width="110"
            label="直属航空部"
            align="center"
          />
          <el-table-column
            prop="directAirScanTime"
            width="150"
            label="直属航空部扫描时间"
            align="center"
          />
          <el-table-column
            prop="chargeStationName.networkName"
            width="110"
            label="收费站点名称"
            align="center"
          />
          <el-table-column
            prop="chargeSuperiorStationName.networkName"
            width="140"
            label="收费上级站点名称"
            align="center"
          />
          <el-table-column
            prop="chargeCity"
            width="110"
            label="收费城市名称"
            align="center"
          />
          <el-table-column
            prop="destinationName"
            width="110"
            label="目的地名称"
            align="center"
          />
          <el-table-column
            prop="destinationCityName"
            width="120"
            label="目的地城市名称"
            align="center"
          />
          <el-table-column
            prop="itemType"
            label="物品类型"
            align="center"
          />
          <el-table-column
            prop="productType"
            label="产品类型"
            align="center"
          />
          <el-table-column
            prop="transportType"
            label="运输方式"
            align="center"
          />
          <el-table-column
            prop="networkWeight"
            label="网点称重"
            align="center"
          />
          <el-table-column
            prop="directMaxWeight"
            width="110"
            label="直属最大称重"
            align="center"
          />
          <el-table-column
            prop="thirdMaxWeight"
            width="120"
            label="第三方最大称重"
            align="center"
          />
          <el-table-column
            prop="length"
            label="长"
            align="center"
          />
          <el-table-column
            prop="wide"
            label="款"
            align="center"
          />
          <el-table-column
            prop="high"
            label="高"
            align="center"
          />
          <el-table-column
            prop="bubbleWeight"
            label="计泡重量"
            align="center"
          />
          <el-table-column
            prop="settleWeight"
            label="结算重量"
            align="center"
          />
          <el-table-column
            prop="feeType"
            label="费用类别"
            align="center"
          />
          <el-table-column
            prop="startSettleAmount"
            label="结算金额"
            align="center"
          />
        </el-table>
        <div style="display: flex;justify-content: space-between;margin-top: 51px;">
          <div class="title2" />
          <div
            class="block"
            style="display: flex; justify-content: flex-end"
          >
            <el-pagination
              background
              :current-page="current"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              layout="total, prev, pager, next"
              :total="+total"
              prev-text="上一页"
              next-text="下一页"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
            />
          </div>
        </div>

      </el-col>
    </el-row>
  </div>
</template>

<script>
import { TransitBillApi } from '@/api/HqFinancePanel'

export default {

  components: {},
  data() {
    return {
      loading: false,
      value1: '',
      form: {
        dimension: '',
        networkName: '',
        endTime: '',
        feeType: '',
        networkNameId: '1',
        pageDate: {
          pageNum: 1,
          pageSize: 10
        },
        startTime: '',
        stationType: '',
        transportCode: ''
      },
      tableData: [],
      current: 0, // 页数
      pages: 0, // 条数
      total: 0 // 总数
    }
  },
  methods: {
    handleSizeChange(val) {
      this.form.pageDate.pageSize = val
      this.onSubmit()
    },
    handleCurrentChange(val) {
      this.form.pageDate.pageNum = val
      this.onSubmit()
    },
    // 序号
    table_index(index) {
      return (this.form.pageDate.pageNum - 1) * this.form.pageDate.pageSize + index + 1
    },
    // 选择时间
    changeTime() {
      if (this.value1 != null) {
        this.form.startTime = this.value1[0]
        this.form.endTime = this.value1[1]
      }
    },
    // 重置
    khClear() {
      Object.keys(this.form).forEach((key) => {
        if (key !== 'pageDate' && key !== 'networkNameId') {
          this.form[key] = ''
        }
      })
      this.tableData = []
      this.value1 = ''
      this.total = ''
      this.current = ''
      this.pages = ''
    },
    // 查询
    async onSubmit() {
      const form1 = {}
      Object.keys(this.form).forEach(key => {
        if (this.form[key]) {
          form1[key] = this.form[key]
        }
      })
      const res = await TransitBillApi(form1)
      this.loading = true
      if (res.code == 200) {
        this.tableData = res.data.data
        this.total = res.data.total
        this.current = res.data.current
        this.pages = res.data.pages
      }
      this.loading = false
    }
  }
}

</script>
<style
  scoped
  lang="scss"
>
.title {
  .input {
    width: 286px;
    // height: 88px;
    background: #FFFFFF;
    border: 1px solid #B4B4B4;
    border-radius: 4px;
  }
}

.head {
  padding: 30px;
}

.title {
  font-size: 16px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
}

.line {
  height: 1px;
  background: #D8D8D8;
  border-radius: 1px;
  margin-top: 0px;
  margin-bottom: 33px;
}

.title1 {
  .text {
    font-size: 18px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #666666;

    // margin-left: 52px;
    .input {
      width: 286px;
      height: 36px;
      background: #FFFFFF;
      // border: 1px solid #B4B4B4;
      border-radius: 4px;
    }

    .input1 {
      width: 650px;
      height: 36px;
      background: #FFFFFF;
      border: 1px solid #B4B4B4;
      border-radius: 4px;
    }
  }
}

.title2 {
  font-size: 18px;
  font-family: Source Han Sans CN;
  font-weight: 400;
  color: #666666;
}

.title3 {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;

  .text {
    font-size: 18px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #EE3000;
  }

  .bt {
    width: 98px;
    height: 36px;
    background: #FFFFFF;
    border: 1px solid #B4B4B4;
    border-radius: 4px;
    font-family: Source Han Sans CN;
    font-weight: 400;
    color: #666666;
  }
}
</style>
